var express = require('express');
var router = express.Router();

var UserModel = require('../../models/user');

// GET /signup 注册
router.post('/', function (req, res, next) {
  var user = {
      name : req.fields.name,
      password : req.fields.password
    }
  UserModel.create(user)
  	.then(function (result) {
  		res.send(result.ops[0].name)
  	}, function (err) {
  		res.send('error');
  	})
});

module.exports = router;
